<template>
	<view class="OrdeDetailsTips">
		<u-popup :show="showPopup" mode="center">
			<view class="warpper">
				<u-cell :border="true">
					<view slot="title">
						<view class="title">{{state==1?'金额明细':'游客信息'}}</view>
					</view>
					<view class="" slot="value">
						<u-icon @click="showPopup = false" name="close-circle" size="60rpx"
							color="rgb(144, 147, 153)">
						</u-icon>
					</view>
				</u-cell>
				<view class="popup" v-if="state == 1">
					<view class="popup-text">
						<text>中央广播电视塔门票</text>
						<text>￥{{getTotal}}</text>
					</view>
					<view class="popup-text" v-for="(item,index) in options" :key="index">
						<text>{{item.proName}}</text>
						<text>￥{{item.proPrice}}×{{item.proCount}}</text>
					</view>
				</view>
				<view class="list" v-if="state == 2">
					<scroll-view scroll-y="true" style="width: 100%;height:600rpx;" >
						<view>
							<view class="list-item" v-for="(item,index) in options" :key="index">
								<view class="list-item-title">{{item.proName}}</view>
								<view class="list-item-wrapper" v-for="(i,x) in item.visitorList" :key="x">
									<view class="list-item-wrapper-text">{{i.name}}</view>
									<view class="list-item-wrapper-text" style="margin: 6rpx 0;">身份证：{{i.idCard}}</view>
									<view class="list-item-wrapper-text">手机号：{{i.phone}}</view>
								</view>
							</view>
						</view>
					</scroll-view>
				</view>
			</view>
		</u-popup>
	</view>
</template>
<script>
	export default {
		name:"OrdeDetailsTips",
		data(){
			return {
				showPopup: false,
				state: 0,
				options: []
			}
		},
		methods:{
			init(state, options){
				this.state = state;
				this.options = options;
				this.showPopup = true;
			}
		},
		computed:{
			getTotal(){
				let total = 0;
				if(this.options.length){
					this.options.forEach(item=>{
						total = total + (item.proCount*item.proPrice);
					});
				}
				return total.toFixed(2)
			}
		}
	}
</script>
<style lang="scss" scoped>
	.OrdeDetailsTips{
		.list{
			padding:0 30rpx 20rpx 30rpx;
			.list-item{
				.list-item-wrapper-text{
					white-space: nowrap;
				}
				.list-item-wrapper{
					&+ .list-item-wrapper{
						margin-top: 20rpx;
					}
					margin-left: 120rpx;
				}
				.list-item-title{
					color: #333333;
					font-size: 30rpx;
					font-weight: bold;
					padding: 30rpx  0;
				}
			}
		}
		.warpper{
			width: 680rpx;
			.title{
				text-align: center;
			}
			.popup{
				padding-bottom: 80rpx;
				.popup-text{
					padding: 0 30rpx;
					display: flex;
					align-items: center;
					justify-content: space-between;
					font-size: 26rpx;
					color: #666666;
					margin-top: 20rpx;
				}			
				.popup-text:nth-of-type(1){
					color: #333333;
					font-size: 28rpx;
				}
			}
		}
	}
</style>